package com.zhs.gccs.adapter;

import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zhs.gccs.R;
import com.zhs.gccs.model.GccsOfProject;

/**
 * Created by chengzf on 2024/7/21.
 */
public class GccsReportGridAdapter extends BaseQuickAdapter<GccsOfProject, BaseViewHolder> {

    public GccsReportGridAdapter() {
        super(R.layout.item_gccs_report_view);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, GccsOfProject bean) {
        TextView tv_count = holder.getView(R.id.tv_count);
        TextView tv_type = holder.getView(R.id.tv_type);
        LinearLayout il_item = holder.getView(R.id.il_item);
        if(bean.isSelected()){
            tv_count.setTextColor(mContext.getResources().getColor(R.color.white));
            tv_type.setTextColor(mContext.getResources().getColor(R.color.white));
            il_item.setBackgroundResource(R.drawable.bg_light_blue_fill);
        }else {
            tv_count.setTextColor(mContext.getResources().getColor(R.color.app_them));
            tv_type.setTextColor(mContext.getResources().getColor(R.color.app_them));
            il_item.setBackgroundResource(R.drawable.bg_light_blue);
        }
        if(bean.isInt()){
            Double rwl = Double.parseDouble(bean.getRwl().toString());
            tv_count.setText((bean.getReportCount()!=null?bean.getReportCount():0)+"/"+rwl.intValue());
        }else {
            tv_count.setText((bean.getReportCount()!=null?bean.getReportCount():0)+"");
        }
        tv_type.setText(bean.getTypeName());
    }
}
